[5.x] Fix Bard/Link Blink cache type collision#14739
Open
simonerd wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug description
Bard::preload()andLink::collections()both use the same Blink cache keyroutable-collection-handles-{site}, but they store different types in it:Bard.php:598returns anIlluminate\Support\Collection(no->all()at the end)Link.php:160returns anarray(has->all())Because
Blink::onceskips the closure on the second call, whichever fieldtype runs first wins. When a blueprint has both Bard and Link fields, Bard runs first and primes the cache with aCollection. Link then gets back aCollectioninstead of thearrayit expects, and passes it on to the nested entries fieldtype as thecollectionsconfig.Why it only shows up now
This collision has existed for a while, but it stayed hidden because the downstream code accepted both arrays and Collections. PR #14718 added a strict
arraytype toEntries::getViewableCollections(), which now throws:How to reproduce
collections:config on the Link)The permission check matters because it triggers the new fallback branch in
getColumnCollection()that passes the configured collections intogetViewableCollections(array).Changes in this PR
Add the missing
->all()inBard::preload()so both fieldtypes write the same type into the shared cache.